<template>
  <div class="show-list">
    <div class="wrap" v-for="floor in floorData" :key="floor.id">
      <div class="recommend-top">
        <div class="left">{{ floor.title }}</div>
        <div class="right">
          更多<span class="iconfont icon-arrow-right"></span>
        </div>
      </div>
      <div class="recommend-bottom">
        <div
          class="recommend-li"
          v-for="item in floor.goodsList"
          :key="item.id"
        >
          <img :src="item.phoneUrl" alt="" />

          <h3 class="ellipsis" style="width: 230px; text-align: center">
            <span class="tag" v-if="item.displayTags">{{
              item.displayTags
            }}</span>
            {{ item.prdName }}
          </h3>
          <p class="ellipsis" style="width: 200px; text-align: center">
            {{ item.prodSellPoint }}
          </p>
          <div class="price">
            <span>￥{{ item.currentPrice }}</span>
            <span
              class="originPrice"
              v-show="item.currentPrice !== item.originPrice"
              >￥{{ item.originPrice }}</span
            >
          </div>
          <div class="flag">{{ item.prdPromotion }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { reqHomeFloor } from "@/api/homeApi/mockHome";
export default {
  name: "XShowList",
  data() {
    return {
      floorData: [],
    };
  },
  async mounted() {
    const res = await reqHomeFloor();
    // console.log(res);
    this.floorData = res;
  },
};
</script>

<style lang="less" scoped>
.show-list {
  background-color: #f1f3f5;
  padding-top: 20px;
  .wrap {
    width: 1200px;
    margin: 0 auto;
    margin-top: 30px;
  }
  .recommend {
    width: 1300px;
  }
  .recommend-top {
    display: flex;
    justify-content: space-between;
    .left {
      font-size: 24px;
    }
    .right {
      font-size: 14px;
    }
  }
  .recommend-bottom {
    width: 1300px;
    padding-top: 20px;
    display: flex;
    flex-wrap: wrap;
    .recommend-li {
      width: 291px;
      height: 408px;
      margin-right: 10px;
      margin-bottom: 10px;
      background-color: #fff;
      display: flex;
      flex-direction: column;
      align-items: center;

      img {
        width: 291px;
        height: 253px;
      }
      h3 {
        .tag {
          color: #fff;
          background-color: #f13956;
          padding: 2px;
          font-size: 12px;
          font-weight: normal;
          border-radius: 5px;
        }
        font-weight: 600;
        font-size: 14px;
      }
      .originPrice {
        font-size: 12px;
        color: #aaa;
        text-decoration: line-through;
      }
      p {
        margin-top: 5px;
        font-size: 13px;
        color: rgb(150 150 150);
      }
      .price {
        margin-top: 20px;
        color: rgb(215 70 82);
        font-size: 16px;
      }
      .flag {
        margin-top: 10px;
        color: rgb(215 70 82);
        font-size: 12px;
        border: 1px solid rgb(215 70 82);
        padding: 2px;
        border-radius: 3px;
      }
    }
  }
}
</style>
